<template>
  <div class="goods">
    <van-button
      v-for="(item, index) in navs"
      :key="item"
      :type="index == n ? 'info' : 'default'"
      @click="n = index"
    >
      {{ item }}
    </van-button>

    <div v-if="goods.length > 0">
      <list-vue :goods="goods[n].content"></list-vue>
    </div>
  </div>
</template>

<script>
import { reqHomeGoods } from "../../../http/api";
export default {
  data() {
    return {
      navs: ["热门推荐", "上新推荐", "所有商品"],
      goods: [],
      n: 0,
    };
  },
  mounted() {
    reqHomeGoods().then((res) => {
      //   console.log(res);
      this.goods = res.data.list;
    });
  },
};
</script>

<style scoped lang="less">
@import "../../../less/index.less";
/* .btn{
  width: 30%;
} */
.van-button--info {
  background: @light;
}
</style>